package com.lemon.boot.po;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 李猛
 * @datetime 2024/3/3 19:21
 * @description 类对象
 */
@Getter
@Setter
@ToString
@ApiModel(value = "日志实体类")
@Accessors(chain = true)
@Document(indexName = "log_index")
public class LogPO {
    @Id
    @ApiModelProperty(value = "ID")
    private Long id;

    @Field(type = FieldType.Long)
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;

    @Field(type = FieldType.Long)
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "用户名")
    private String userName;

    @Field(type = FieldType.Ip)
    @ApiModelProperty(value = "IP地址")
    private String ip;

    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "请求的URI")
    private String uri;

    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "请求方式")
    private String method;

    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "请求参数")
    private String param;

    /*@ApiModelProperty(value = "创建时间")
    @Field(type = FieldType.Date, store = true, format = DateFormat.date_hour_minute_second, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;*/

    @Field(type = FieldType.Long)
    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    @Transient
    @ApiModelProperty(value = "创建时间")
    private String createTimeStr;
}
